<%@ page import="org.springframework.web.context.request.RequestScope" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/7/12
  Time: 8:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<jsp:useBean id="user" class="com.nothing.Model.User" scope="request" ></jsp:useBean>
<%
    String basePath = request.getContextPath();
// 将contextPath保存到request中
    request.setAttribute("basePath", basePath);
%>
<html>
<body >
<div class="container" >
    <div class="row">
        <div class="col-md-4"></div>
        <div class="col-md-4"  id="login-box">
            <form method="post" action="/login" onsubmit="return toSubmit()"  class="bs-example bs-example-form" role="form" >
                <div class="input-group input-group-lg">
                    <span style="width: 88px" class="input-group-addon" >用户名</span>
                    <input name="username" id="ff" class="form-control"></input>
                </div>
                <div  style="margin-top: 16px" class="input-group input-group-lg">
                    <span  style="width: 88px" class="input-group-addon">密码</span>
                    <input name="password" id="dd" class="form-control"></input>
                </div>
                <div class="row" style="margin-top: 24px">
                    <div class="col-md-4">
                    </div>
                    <div class="col-md-4"></div>
                    <div class="col-md-4">
                        <div style="color: fuchsia">
                            ${res}
                        </div>
                        <div class="input-group input-group-lg">
                                <input type="submit" value="登录" style="background: #2b669a;color: white" class="form-control">
                        </div>
                    </div>
                </div>
            </form>
            <form method="get" action="/register" >
                <input type="submit" value="注册" id="register" style="background:#2b669a ">
            </form>
        </div>
        <div class="col-md-4"></div>
    </div>
</div>

<script >
    function toSubmit() {
        console.log("sk:"+$("#register").attr("value"));
        var reg=$("#register").attr("value");
        var val = document.getElementById("ff").value;
        var val1 = document.getElementById("dd").value;
        if(val.length==0){
            alert("不能为空!");
            return false;
        }else if(val1.length==0){
            alert("不能为空!");
            return false;
        }else{
          /*  document.getElementById("ff").value="";
            document.getElementById("dd").value="";*/
            return true;
        }
    }
</script>
</body>
<head>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <title>Title</title>
    <style type="text/css">
        body{
            background: url("/images/a.jpg");
        }
        #login-box {
            /*border:1px solid #F00;*/
            padding: 35px;
            border-radius:15px;
            background: #56666B;
            color: #fff;
            margin-top: 200px;
        }
    </style>
</head>
</html>
